Skip to content

fix: Check content type before LSP enablement#1552

Merged
rubenporras merged 1 commit into
eclipse-lsp4e:mainfrom
bytehaufen:check-content-type-before-lsp-enablement
Jun 24, 2026
Merged

fix: Check content type before LSP enablement#1552
rubenporras merged 1 commit into
eclipse-lsp4e:mainfrom
bytehaufen:check-content-type-before-lsp-enablement

Conversation

@bytehaufen

Copy link
Copy Markdown
Contributor

This changes the order of checks when looking up available language servers.

Before, LSP4E evaluated mapping.isEnabled(uri) before checking whether the mapping's content type matched the file. For mappings with an enabledWhen, that can be expensive and may load the file as a document even when the mapping does not apply.

With this change, the content type is checked first, so enabledWhen is only evaluated for matching mappings.

Fixes #1551

@FlorianKroiss FlorianKroiss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The fix looks straightforward.

@rubenporras

Copy link
Copy Markdown
Contributor

Thank you for the PR!

@rubenporras rubenporras merged commit 124c25f into eclipse-lsp4e:main Jun 24, 2026
10 of 11 checks passed
@bytehaufen

Copy link
Copy Markdown
Contributor Author

Thanks for the quick merge, and thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid eager language-server enablement checks

3 participants